import instance from '@/utils/request'

//获得文章分类
export const bookCategory=()=>{
  return instance.request({
    url:'/book/bookCategory',
    method:'get'
  });
};

//删除文章分类
export const delCategory = (id) => {
  return instance.request({
    url: `/book/bookCategory/${id}`,
    method: 'delete'
  })
}

//添加文章分类
export const addCategory = (data) =>{
  return instance.request({
		url:'/book/bookCategory',
		method:'post',
		data:data
  })
}

//修改文章分类
export const updateCategory = (data) =>{
  return instance.request({
		url:'/book/bookCategory',
		method:'put',
		data:data
  })
}


//分页条件查询书本
export const listBook = (params) => {
  return instance.request({
    url: "/book/list",
    method: "get",
    params: params
  })
}


//删除图书
export const deleteBook = (id) => {
  return instance.request({
    url: `/book/${id}`,
    method: 'delete'
  })
}

//添加图书
export const addBook = (data) =>{
  return instance.request({
		url:'/book',
		method:'post',
		data:data
  })
}


//删除图书
export const updateBook= (data) =>{
  return instance.request({
		url:'/book',
		method:'put',
		data:data
  })
}

//图书分类
export const getCategoryData = () => {
  return instance.request({
    url: '/book/chart/category',
    method: 'get'
  })
}

//图书价格
export const getPriceData = () => {
  return instance.request({
    url: '/book/chart/price',
    method: 'get'
  })
}
